package org.ruoyi.common.chat.handler;

import org.ruoyi.common.chat.request.ChatRequest;
import org.springframework.web.socket.WebSocketSession;

import java.io.IOException;
import java.util.function.Consumer;

/**
 * @author eric
 */
public interface WebSocketMessageHandler {
    /**
     * 处理聊天消息
     *
     * @param chatRequest     聊天请求对象
     * @param session         WebSocket会话对象
     * @param messageConsumer 消息消费者，用于发送响应消息
     * @throws IOException 发送消息时可能抛出的异常
     */
    void handleWebSocketChat(ChatRequest chatRequest, WebSocketSession session, Consumer<String> messageConsumer);
}
